package com.brook.springcloud.controller;

import com.brook.springcloud.pojo.Dept;
import com.brook.springcloud.service.DeptClientService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Brook
 */
@RestController
public class DeptConsumerController {

    @Resource
    DeptClientService service;

    @RequestMapping("/consumer/dept/add")
    public Boolean add(Dept dept){
        return service.addDept(dept);
    }

    @RequestMapping("/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id){
        return service.queryById(id);
    }

    @RequestMapping("/consumer/dept/get/list")
    public List<Dept> list(){
        return service.queryAll();
    }

}
